import http from '@/utils/http'
import { useAuthStore } from '@/stores'

export const playListGetService = () => {
    return http.get('/api/playlist', {params: {t:useAuthStore().audioToken}})
}

type requestAddPlaylist = {
    name:string,
    songs: string[] | null
}

export const addPlayListService = (req: requestAddPlaylist) => {
    return http.post('/api/playlists', req)
}

export const getPlayListSongsService = (id: number) => {
    return http.get('/api/playlists/' + id + '/songs' )
}

export const playAllStoreService = ( order: string, limit: number ) => {
    return http.get('/api/queue/fetch', {params: {order:order, limit:limit}})
}